<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS语法_while语句</title>

    <script>

        // 1 ~ 100 的和
        var a = 1;
        var sum = 0;
        while(a <= 100) {
            sum += a;
            a++;
        }
        alert(sum);

    </script>
</head>
<body>

</body>
</html>